3.295 \(\int (a+b \sin (c+\frac{d}{x}))^2 \, dx\)

Optimal. Leaf size=94 \[ a^2 x-2 a b d \cos (c) \text{CosIntegral}\left (\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )+2 a b x \sin \left (c+\frac{d}{x}\right )-b^2 d \sin (2 c) \text{CosIntegral}\left (\frac{2 d}{x}\right )-b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right ) \]

[Out]

a^2*x - 2*a*b*d*Cos[c]*CosIntegral[d/x] - b^2*d*CosIntegral[(2*d)/x]*Sin[2*c] + 2*a*b*x*Sin[c + d/x] + b^2*x*S
in[c + d/x]^2 + 2*a*b*d*Sin[c]*SinIntegral[d/x] - b^2*d*Cos[2*c]*SinIntegral[(2*d)/x]

________________________________________________________________________________________

Rubi [A]  time = 0.22635, antiderivative size = 94, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 8, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.571, Rules used = {3361, 3317, 3297, 3303, 3299, 3302, 3313, 12} \[ a^2 x-2 a b d \cos (c) \text{CosIntegral}\left (\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )+2 a b x \sin \left (c+\frac{d}{x}\right )-b^2 d \sin (2 c) \text{CosIntegral}\left (\frac{2 d}{x}\right )-b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right ) \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[c + d/x])^2,x]

[Out]

a^2*x - 2*a*b*d*Cos[c]*CosIntegral[d/x] - b^2*d*CosIntegral[(2*d)/x]*Sin[2*c] + 2*a*b*x*Sin[c + d/x] + b^2*x*S
in[c + d/x]^2 + 2*a*b*d*Sin[c]*SinIntegral[d/x] - b^2*d*Cos[2*c]*SinIntegral[(2*d)/x]

Rule 3361

Int[((a_.) + (b_.)*Sin[(c_.) + (d_.)*((e_.) + (f_.)*(x_))^(n_)])^(p_.), x_Symbol] :> Dist[1/(n*f), Subst[Int[x
^(1/n - 1)*(a + b*Sin[c + d*x])^p, x], x, (e + f*x)^n], x] /; FreeQ[{a, b, c, d, e, f}, x] && IGtQ[p, 0] && In
tegerQ[1/n]

Rule 3317

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Sin[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 0] && (EqQ[n, 1] ||
IGtQ[m, 0] || NeQ[a^2 - b^2, 0])

Rule 3297

Int[((c_.) + (d_.)*(x_))^(m_)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[((c + d*x)^(m + 1)*Sin[e + f*x])/(d*(
m + 1)), x] - Dist[f/(d*(m + 1)), Int[(c + d*x)^(m + 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && LtQ[
m, -1]

Rule 3303

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Dist[Cos[(d*e - c*f)/d], Int[Sin[(c*f)/d + f*x]
/(c + d*x), x], x] + Dist[Sin[(d*e - c*f)/d], Int[Cos[(c*f)/d + f*x]/(c + d*x), x], x] /; FreeQ[{c, d, e, f},
x] && NeQ[d*e - c*f, 0]

Rule 3299

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[SinIntegral[e + f*x]/d, x] /; FreeQ[{c, d,
 e, f}, x] && EqQ[d*e - c*f, 0]

Rule 3302

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[CosIntegral[e - Pi/2 + f*x]/d, x] /; FreeQ
[{c, d, e, f}, x] && EqQ[d*(e - Pi/2) - c*f, 0]

Rule 3313

Int[((c_.) + (d_.)*(x_))^(m_)*sin[(e_.) + (f_.)*(x_)]^(n_), x_Symbol] :> Simp[((c + d*x)^(m + 1)*Sin[e + f*x]^
n)/(d*(m + 1)), x] - Dist[(f*n)/(d*(m + 1)), Int[ExpandTrigReduce[(c + d*x)^(m + 1), Cos[e + f*x]*Sin[e + f*x]
^(n - 1), x], x], x] /; FreeQ[{c, d, e, f, m}, x] && IGtQ[n, 1] && GeQ[m, -2] && LtQ[m, -1]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rubi steps

\begin{align*} \int \left (a+b \sin \left (c+\frac{d}{x}\right )\right )^2 \, dx &=-\operatorname{Subst}\left (\int \frac{(a+b \sin (c+d x))^2}{x^2} \, dx,x,\frac{1}{x}\right )\\ &=-\operatorname{Subst}\left (\int \left (\frac{a^2}{x^2}+\frac{2 a b \sin (c+d x)}{x^2}+\frac{b^2 \sin ^2(c+d x)}{x^2}\right ) \, dx,x,\frac{1}{x}\right )\\ &=a^2 x-(2 a b) \operatorname{Subst}\left (\int \frac{\sin (c+d x)}{x^2} \, dx,x,\frac{1}{x}\right )-b^2 \operatorname{Subst}\left (\int \frac{\sin ^2(c+d x)}{x^2} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )-(2 a b d) \operatorname{Subst}\left (\int \frac{\cos (c+d x)}{x} \, dx,x,\frac{1}{x}\right )-\left (2 b^2 d\right ) \operatorname{Subst}\left (\int \frac{\sin (2 c+2 d x)}{2 x} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )-\left (b^2 d\right ) \operatorname{Subst}\left (\int \frac{\sin (2 c+2 d x)}{x} \, dx,x,\frac{1}{x}\right )-(2 a b d \cos (c)) \operatorname{Subst}\left (\int \frac{\cos (d x)}{x} \, dx,x,\frac{1}{x}\right )+(2 a b d \sin (c)) \operatorname{Subst}\left (\int \frac{\sin (d x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x-2 a b d \cos (c) \text{Ci}\left (\frac{d}{x}\right )+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )-\left (b^2 d \cos (2 c)\right ) \operatorname{Subst}\left (\int \frac{\sin (2 d x)}{x} \, dx,x,\frac{1}{x}\right )-\left (b^2 d \sin (2 c)\right ) \operatorname{Subst}\left (\int \frac{\cos (2 d x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x-2 a b d \cos (c) \text{Ci}\left (\frac{d}{x}\right )-b^2 d \text{Ci}\left (\frac{2 d}{x}\right ) \sin (2 c)+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )-b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )\\ \end{align*}

Mathematica [A]  time = 0.144822, size = 105, normalized size = 1.12 \[ \frac{1}{2} \left (2 a^2 x-4 a b d \cos (c) \text{CosIntegral}\left (\frac{d}{x}\right )+4 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )+4 a b x \sin \left (c+\frac{d}{x}\right )-2 b^2 d \sin (2 c) \text{CosIntegral}\left (\frac{2 d}{x}\right )-2 b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )-b^2 x \cos \left (2 \left (c+\frac{d}{x}\right )\right )+b^2 x\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sin[c + d/x])^2,x]

[Out]

(2*a^2*x + b^2*x - b^2*x*Cos[2*(c + d/x)] - 4*a*b*d*Cos[c]*CosIntegral[d/x] - 2*b^2*d*CosIntegral[(2*d)/x]*Sin
[2*c] + 4*a*b*x*Sin[c + d/x] + 4*a*b*d*Sin[c]*SinIntegral[d/x] - 2*b^2*d*Cos[2*c]*SinIntegral[(2*d)/x])/2

________________________________________________________________________________________

Maple [A]  time = 0.024, size = 110, normalized size = 1.2 \begin{align*} -d \left ( -{\frac{{a}^{2}x}{d}}+2\,ab \left ( -{\frac{x}{d}\sin \left ( c+{\frac{d}{x}} \right ) }-{\it Si} \left ({\frac{d}{x}} \right ) \sin \left ( c \right ) +{\it Ci} \left ({\frac{d}{x}} \right ) \cos \left ( c \right ) \right ) -{\frac{{b}^{2}x}{2\,d}}-{\frac{{b}^{2}}{4} \left ( -2\,{\frac{x}{d}\cos \left ( 2\,{\frac{d}{x}}+2\,c \right ) }-4\,{\it Si} \left ( 2\,{\frac{d}{x}} \right ) \cos \left ( 2\,c \right ) -4\,{\it Ci} \left ( 2\,{\frac{d}{x}} \right ) \sin \left ( 2\,c \right ) \right ) } \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sin(c+d/x))^2,x)

[Out]

-d*(-a^2*x/d+2*a*b*(-sin(c+d/x)*x/d-Si(d/x)*sin(c)+Ci(d/x)*cos(c))-1/2*b^2*x/d-1/4*b^2*(-2*cos(2*d/x+2*c)*x/d-
4*Si(2*d/x)*cos(2*c)-4*Ci(2*d/x)*sin(2*c)))

________________________________________________________________________________________

Maxima [C]  time = 1.22124, size = 185, normalized size = 1.97 \begin{align*} -{\left ({\left ({\left ({\rm Ei}\left (\frac{i \, d}{x}\right ) +{\rm Ei}\left (-\frac{i \, d}{x}\right )\right )} \cos \left (c\right ) -{\left (-i \,{\rm Ei}\left (\frac{i \, d}{x}\right ) + i \,{\rm Ei}\left (-\frac{i \, d}{x}\right )\right )} \sin \left (c\right )\right )} d - 2 \, x \sin \left (\frac{c x + d}{x}\right )\right )} a b - \frac{1}{2} \,{\left ({\left ({\left (-i \,{\rm Ei}\left (\frac{2 i \, d}{x}\right ) + i \,{\rm Ei}\left (-\frac{2 i \, d}{x}\right )\right )} \cos \left (2 \, c\right ) +{\left ({\rm Ei}\left (\frac{2 i \, d}{x}\right ) +{\rm Ei}\left (-\frac{2 i \, d}{x}\right )\right )} \sin \left (2 \, c\right )\right )} d + x \cos \left (\frac{2 \,{\left (c x + d\right )}}{x}\right ) - x\right )} b^{2} + a^{2} x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(c+d/x))^2,x, algorithm="maxima")

[Out]

-(((Ei(I*d/x) + Ei(-I*d/x))*cos(c) - (-I*Ei(I*d/x) + I*Ei(-I*d/x))*sin(c))*d - 2*x*sin((c*x + d)/x))*a*b - 1/2
*(((-I*Ei(2*I*d/x) + I*Ei(-2*I*d/x))*cos(2*c) + (Ei(2*I*d/x) + Ei(-2*I*d/x))*sin(2*c))*d + x*cos(2*(c*x + d)/x
) - x)*b^2 + a^2*x

________________________________________________________________________________________

Fricas [A]  time = 1.55331, size = 373, normalized size = 3.97 \begin{align*} -b^{2} x \cos \left (\frac{c x + d}{x}\right )^{2} - b^{2} d \cos \left (2 \, c\right ) \operatorname{Si}\left (\frac{2 \, d}{x}\right ) + 2 \, a b d \sin \left (c\right ) \operatorname{Si}\left (\frac{d}{x}\right ) + 2 \, a b x \sin \left (\frac{c x + d}{x}\right ) +{\left (a^{2} + b^{2}\right )} x -{\left (a b d \operatorname{Ci}\left (\frac{d}{x}\right ) + a b d \operatorname{Ci}\left (-\frac{d}{x}\right )\right )} \cos \left (c\right ) - \frac{1}{2} \,{\left (b^{2} d \operatorname{Ci}\left (\frac{2 \, d}{x}\right ) + b^{2} d \operatorname{Ci}\left (-\frac{2 \, d}{x}\right )\right )} \sin \left (2 \, c\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(c+d/x))^2,x, algorithm="fricas")

[Out]

-b^2*x*cos((c*x + d)/x)^2 - b^2*d*cos(2*c)*sin_integral(2*d/x) + 2*a*b*d*sin(c)*sin_integral(d/x) + 2*a*b*x*si
n((c*x + d)/x) + (a^2 + b^2)*x - (a*b*d*cos_integral(d/x) + a*b*d*cos_integral(-d/x))*cos(c) - 1/2*(b^2*d*cos_
integral(2*d/x) + b^2*d*cos_integral(-2*d/x))*sin(2*c)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \sin{\left (c + \frac{d}{x} \right )}\right )^{2}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(c+d/x))**2,x)

[Out]

Integral((a + b*sin(c + d/x))**2, x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \sin \left (c + \frac{d}{x}\right ) + a\right )}^{2}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(c+d/x))^2,x, algorithm="giac")

[Out]

integrate((b*sin(c + d/x) + a)^2, x)